package com.ssy.lingxi.logistics.controller;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.logistics.model.request.LogisticsHandleOrderListRequest;
import com.ssy.lingxi.logistics.model.response.LogisticsOrderHandleListResponse;
import com.ssy.lingxi.logistics.model.response.StatusVO;
import com.ssy.lingxi.logistics.service.ILogisticsOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @menu 物流能力 - 物流单处理 - 物流单查询
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/10
 */
@RestController
@RequestMapping("/logistics/orderConfirm")
public class LogisticsOrderConfirmController extends BaseController {

    @Resource
    private ILogisticsOrderService logisticsOrderService;

    /**
     * 物流单分页列表 - 外部状态下拉查询
     * @return 返回结果
     */
    @RequestMapping(value = "/statusList", method = RequestMethod.GET)
    public Wrapper<List<StatusVO>> listLogisticsOrderStatus() {
        return logisticsOrderService.listLogisticsOrderStatus();
    }

    /**
     * 物流单分页列表
     * @param request 接口参数
     * @return 返回结果
     */
    @GetMapping("/page")
    public Wrapper<PageData<LogisticsOrderHandleListResponse>> pageLogisticsOrder(LogisticsHandleOrderListRequest request) {
        UserLoginCacheDTO sysUser = getSysUser();
        return logisticsOrderService.pageHandleLogisticsOrder(request, sysUser);
    }
}
